package demo1;

public class Test {

    public static void running(IRunning iRunning){
        iRunning.run();
    }

    public static void swimming(ISwimming iSwimming){
        iSwimming.swim();
    }

    public static void flying(IFly iFly){
        iFly.fly();
    }

    public static void eating(Animal animal){
        animal.eat();
    }

    public static void main(String[] args) {
        running(new Dog("旺财", 3));
        swimming(new Dog("旺财", 3));
        eating(new Dog("旺财", 3));

        System.out.println("=====================");

        running(new Duck("唐老鸭", 2));
        swimming(new Duck("唐老鸭", 2));
        flying(new Duck("唐老鸭", 2));
        eating(new Duck("唐老鸭", 2));

        System.out.println("======================");

        running(new Rebot());
    }
}
